package o;

import java.util.ArrayList;
import java.util.List;
import okhttp3.internal.connection.RealConnection;

public final class fuq {
    private final ftt ˊ;
    private int ˎ = 0;
    private final List<RealConnection> ˏ = new ArrayList();

    public fuq(ftt o_ftt) {
        this.ˊ = o_ftt;
    }

    public ftt ॱ() {
        return this.ˊ;
    }

    public void ˏ(RealConnection realConnection) {
        if (!this.ˏ.contains(realConnection)) {
            this.ˏ.add(realConnection);
        }
    }

    public void ˎ(RealConnection realConnection) {
        this.ˏ.remove(realConnection);
    }

    public boolean ˋ() {
        return this.ˏ.isEmpty();
    }

    public RealConnection ˏ() {
        return ˎ();
    }

    private RealConnection ˎ() {
        RealConnection realConnection = null;
        int i = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
        for (RealConnection realConnection2 : this.ˏ) {
            int i2;
            RealConnection realConnection3;
            int size = realConnection2.allocations.size();
            if (size >= realConnection2.allocationLimit || realConnection2.noNewStreams || size >= i) {
                i2 = i;
                realConnection3 = realConnection;
            } else {
                int i3 = size;
                realConnection3 = realConnection2;
                i2 = i3;
            }
            i = i2;
            realConnection = realConnection3;
        }
        return realConnection;
    }
}
